'''
@Project ：python-study
@File    ：9.5折线图：各国电影年产量.py
@IDE     ：PyCharm
@Author  ：SUNLIN
@Date    ：2025/3/13 8:24:35
'''

import matplotlib.pyplot as plt
import numpy as np
import C8处理与分析.pandas_def as pdef

plt.rcParams['font.sans-serif'] = ['SimHei']  # 使用黑体
plt.rcParams['axes.unicode_minus'] = False  # 解决负号显示问题

# 获取统计数据
file_path = 'D:\develop\projects\Python Project\python-study\doc\datasource\C8-8.5-数据采集-clean.xlsx'
usecols = ['movie_name', 'country', 'language', 'release_date', 'average_score', ]
country_data = pdef.country_year_tj(file_path, usecols)
# print(country_data)

# # 获取折线图
# country_data.plot()
# plt.show()
# # 当legend过多时分列展示
# plt.legend(ncol=4)

# 创建直方图
c_count_list = []
print(country_data.columns)

for i in list(country_data.columns):
    c_count_list.append(country_data[i].sum())
plt.bar(country_data.columns, c_count_list, 0.5)
plt.show()
